package com.example.function.project.dao.one;

import com.example.common.dao.BaseJpaRepository;
import com.example.function.project.model.one.ProjectUserRole;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface ProjectUserRoleJpaRepository extends BaseJpaRepository<ProjectUserRole, Long>{
    public List<ProjectUserRole> findProjectUserRolesByUserId(Long userId);

    @Query(value = "select t.project_id_fk as projectId from tbl_project_user_role t where t.user_id_fk = :userId",nativeQuery = true)
    public List<Long> findProjectIdsByUserId(@Param("userId") Long userId);

    public List<ProjectUserRole> findProjectUserRolesByProjectId(Long projectId);

    public void deleteProjectUserRolesByProjectId(Long projectId);
}
